package com.pureland.security.exceptions;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.pureland.security.exceptions.serializers.Auth2ExceptionSerializer;
import org.springframework.http.HttpStatus;

/**
 * @projectName: pureland_cloud
 * @className: com.pureland.security.exceptions.ForbiddenException
 * @description: 403禁止访问异常类
 * @author: tong.li
 * @createTime: 2020/11/17 16:29
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 */
@JsonSerialize(using = Auth2ExceptionSerializer.class)
public class ForbiddenException extends Auth2Exception {

    private static final long serialVersionUID = -545612721324191L;

    public ForbiddenException(String msg) {
        super(msg);
    }

    @Override
    public String getOAuth2ErrorCode() {
        return "access_denied";
    }

    @Override
    public int getHttpErrorCode() {
        return HttpStatus.FORBIDDEN.value();
    }

    @Override
    public HttpStatus getHttpStatus() {
        return HttpStatus.FORBIDDEN;
    }
}
